package com.witte.serviceImp;

import com.witte.dao.NewCustomerMapper;
import com.witte.entity.NewCustomer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Component
public class Scheduled {
	@Autowired
	NewCustomerMapper  newCustomerMapper;

	@org.springframework.scheduling.annotation.Scheduled(cron="0/10 * * * * *")
	public void test() {
		List<NewCustomer> list = newCustomerMapper.selectTime();

		for(int i=0; i<list.size(); i++) {
			NewCustomer newCustomer = list.get(i);
			newCustomer.setNowtime("超过六个月");
			newCustomerMapper.updateByPrimaryKeySelective(newCustomer);
		}
	}
}
